Generally, in a client-server system, client devices may make requests which are responded to by a server. For example, if a client device desires certain data from a database, it may transmit a request to a server device, which furnishes the information to the client device. Referring to FIG. 1, a connection mode (generally refers to means for communicating with other computing devices) of a client device 12 may need to be manually configured before the client device 12 can communicate with a server device (e.g., server devices 14a and 14b). The correct configuration may depend on whether the server devices 14a or 14b may be directly accessible via a communication link from a current location of the client device 12. As shown, the client device 12 may directly access the server device 14a from its current location 16a via a connection 18a. However, the server device 14b may not be directly accessible by the client device 12, and a gateway device 10 may be used to enable a connection 18b from the client device 12 to the gateway device 10, and a connection 18c from the gateway device 10 to the server device 14b which is located in location 16b. 
Once configured, the connection mode setting of the client device 12 generally remains static regardless from which locations 16a or 16b the client device 12 is connecting. To reduce latency, it may be desirable for the client device 12 to communicate directly with the server device 14a via the connection 18a. As noted above, when the client device 12 is connecting from an isolated location 16a, a direct connection to the server device 14b may not be possible and the client device 12 may need to connect through the gateway device 10.
It may be possible to configure the client device 12 to always connect via the connection 18b through the gateway device 10 to any desired server devices. This, however, may result in that a communication with the server device 14 can be established regardless from which location 16a or 16b the client device 12 is connecting. As shown in FIG. 1, connecting via 18b through the gateway device 10 may not be the optimal choice when a direct connection 18a is possible.
One of the major disadvantages of using the gateway device 10 is that latency may be increased and that a point of failure may be introduced. If the gateway device 10 for any reasons becomes inoperative, all connections 18b and 18c passing through it may become lost and new connections may not be established in a timely manner. Therefore, it may be desirable to limit the use of the gateway device 10 where its use is not strictly required.
Accordingly, there is a need for a system and method for selecting a connection mode and communicating between a client device and a server device based on the dynamic devices and network conditions (e.g., the current locations of both the client and server devices).